package com.zengshuai.miniprogrambackend.Common.constant;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class OssClient {
    @Autowired
    MyOss oss;
    private final OSS ossClient = null;

    private OssClient() {
    }

    public OSS getOssClient() {
        if (ossClient == null) {
            return new OSSClientBuilder().build(oss.ENDPOINT, oss.ACCESS_KEY_Id, oss.ACCESS_KEY_SECRET);
        } else {
            return ossClient;
        }

    }

}
